/*
 * ScriptGeneratorUI
 * 
 * Version: 1.0
 * 
 * Date: 12/05/2010
 * 
 * Licensed under Eclipse open source license
 */
package slhs.tempo.scriptGenerator;

import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class ScriptGeneratorUI extends JFrame implements ActionListener {

    private JPanel basePanel;
    public static final String MODE_SELECTOR_SCREEN_CARD = "Mode Selector Screen";

    /* Constructor for Script Generator UI */
    public ScriptGeneratorUI() {
	basePanel = new JPanel(new CardLayout());
	this.setTitle("Mode Selector");
	this.add(basePanel);
	setupModeSelectorScreen(basePanel);
	this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    /*
     * Routine to set up the mode selector screen, which enables user to select experiment mode
     */
    private void setupModeSelectorScreen(JPanel basePanel) {
	JPanel modeSelectorBasePanel = new JPanel();
	ModeSelectorScreenHandler modeSelectorScreenHandler = ModeSelectorScreenHandler.getInstance(basePanel, this);
	modeSelectorBasePanel = modeSelectorScreenHandler.getPanel();
	basePanel.add(modeSelectorBasePanel, MODE_SELECTOR_SCREEN_CARD);
    }

    protected boolean draw(int x, int y, int width, int height) {
	this.setBounds(x, y, width, height);
	this.setResizable(false);
	return this.isVisible();
    }

    @Override
    public void actionPerformed(ActionEvent event) {
	// Currently doing nothing here, but can be used in case a warning
	// dialogue or something
	// has to be created on experiment type selection.
    }

}
